<template>
  <div class="home">
    <active></active>
    <div
      id="container"
      style="width: 100vw; height: 90vh; border: 1px solid #ccc"
    ></div>
  </div>
</template>

<script>
import active from '@/components/active.vue'
import AMapLoader from "@amap/amap-jsapi-loader";
export default {
  name: "HomeView",
  components:{
    active
  },
  data() {
    return {
      map: null,
    };
  },
  mounted() {
    this.init();
    // this.getIpConfig()

  },
  methods: {
    init() {
      AMapLoader.load({
        key: "ce27c108602f4b67e769eb9601579df6",
        version: "2.0",
        plugins: [""],
      }).then((AMap) => {
        this.map = new AMap.Map("container", {
          // 设置地图容器
          viewMode: "3D",
          zoom: 6,
          center: [109.602725, 34.076636],
          mapStyle: "amap://styles/blue", //地图类型
          position: new AMap.LngLat(116.39, 39.9), // 经纬度对象，也可以是经纬度构成的一维数组[116.39, 39.9]
        title: "北京",
        }).catch(e => {
          console.log('加载失败',e);
        });
      });
    },
  }
    
  
}
</script>
<style>
.home {
  margin: 0;
  padding: 0;
}
</style>
